package cn.devpt.dev.auth.controller;

import java.util.ArrayList;
import java.util.List;

import cn.devpt.dev.base.bean.PtMsg;
import cn.devpt.dev.util.PtUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.devpt.dev.dao.JpaUtil;
import cn.devpt.dev.dao.QueryParams;
import cn.devpt.dev.auth.entity.AuthUser;

/**
 * @author wxl 只是测试用
 */
@Controller
@RequestMapping("test") // 注意路径
public class JustTestController {

    /**
     * 通用列表查询
     *
     * @param params
     * @return
     */
    @RequestMapping(value = "/find")
    @ResponseBody
    public PtMsg find(String testId) {
        System.out.println(testId + "---");
        List<AuthUser> rs = new ArrayList<>();
        AuthUser u = new AuthUser();
        u.setUserId("322");
        rs.add(u);
        rs.add(u);
        rs.add(u);
        return PtUtil.genMsg(rs);
    }

    @RequestMapping(value = "/testNativeUpdate")
    @ResponseBody
    public PtMsg testNativeUpdate(String testId) {
        QueryParams paramsxx = new QueryParams();
        paramsxx.addParam(1, "wxl");
        int num= JpaUtil.execNativeUpdate("UPDATE AUTH_USER SET name = 'wxlwxlwxl' WHERE account = ?1 ", paramsxx);
        System.out.println(num);
        return PtUtil.genMsg(null);
    }

}
